<?php
//用来更新的
   $connect=mysql_connect("localhost","root","192510");
   mysql_select_db("news",$connect);
   $sql="select * from email_new";
   $result=mysql_query($sql);
   $row=mysql_fetch_assoc($result);
   //得到checkbox中的值

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.6.3.min.js"></script>
</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">邮件配置</a></li>
    <li><a href="#">服务器配置</a></li>
    </ul>
    </div>
    
    <div class="formbody">
    <div class="formtitle"><span>基本信息</span></div>
    <ul class="forminfo">
	<input type="hidden" name="id" id="id" value="<?php echo $row['id'];?>"/>
    <li><label>邮件服务器地址</label><input name="from_server" id="from_server"  type="text" class="dfinput" value="<?php echo $row['from_server'];?>" /><i>eg:smtp.163.com</i></li>
    <li><label>用户名</label><input name="from_email" id="from_email" type="text" class="dfinput" value="<?php echo $row['from_email'];?>"/></li>
    <li><label>密码</label><cite><input type="password" name="pass" id="pass"  class="dfinput" value="<?php echo $row['pass'];?>" /></li>
    <li><label>测试邮箱</label><input name="cesi_email" id="cesi_email" type="test" class="dfinput" value="<?php echo $row['cesi_email'];?>"/></li>
    <li><label>&nbsp;</label><input name="" type="button" class="btn" value="确认保存"  onclick="tijiao();"/>&nbsp;&nbsp;&nbsp;&nbsp;<input name="" type="button" class="btn" value="测试" onclick="cesi();"/></li>
    </ul>
    </div>
	
</body>

</html>
<script>
 function tijiao(){
	       var id=$("#id").val();
		   
		   var from_server=$("#from_server").val();
		   var from_email=$("#from_email").val();
		   var pass=$("#pass").val();
		   var cesi_email=$("#cesi_email").val();
		    
		   if(from_server==null||from_server.length==0||from_email==null||from_email.length==0||pass==null||pass.length==0){
			   alert("请重新配置,服务器,用户名,密码,不能为空!")
			   
			   
		   }else{
			   
			       $.post("insert_email_commit.php",
		           {     
						id:id,
						from_server:from_server,
						from_email:from_email,
						pass:pass,
						cesi_email:cesi_email
			 
				   },
		   
					function(data){
					alert("操作成功");
				  })
			   
		   }
		   
		   


	 } 

	  function cesi(){
		 
		   $.post("email_cesi.php",
		   {},
		   function(data){
			   
			   alert("邮件已经发送, 请注意查收");
			   
		   })
		   
	 }
	 

</script>



